package com.dhl.state.sttatepackage;

import com.dhl.state.RaffleActivity;

/**
 * 发放奖品状态
 * @author Administrator
 *
 */
public class DispenseState extends State {

    /**
     * 具体活动
     */
    RaffleActivity activity;

    /**
     * 初始化
     * @param activity
     */
    public DispenseState(RaffleActivity activity) {
        this.activity = activity;
    }
    
    //
    @Override
    public void deductMoney() {
        System.out.println("不能扣除积分");
    }

    @Override
    public boolean raffle() {
        System.out.println("不能抽奖");
        return false;
    }


    @Override
    public void dispensePrize() {
        if(activity.getCount() > 0){
            System.out.println("中奖了");
            //  发放奖品后该，设置为不能抽奖状态
            activity.setState(activity.getNoRafflleState());
        }else{
            System.out.println("很遗憾奖品发送完毕");
            // 奖品发放完毕，后续不可抽奖
            activity.setState(activity.getDispensOutState());
        }

    }
}
